//
//  GuideView.m
//  ShrimpCrowdordering
//
//  Created by 骆锴 on 2018/8/28.
//  Copyright © 2018年 郑洲. All rights reserved.
//

#import "GuideView.h"

@interface GuideView()

@property (nonatomic, strong) UIImageView   *bgView;
@property (nonatomic, strong) UILabel       *titleLabel;
@property (nonatomic, strong) UILabel       *contentLabel;
@property (nonatomic, strong) UIButton      *sureBtn;

@end

@implementation GuideView

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        _bgView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScreenX375(300))/2, ScreenX375(100), ScreenX375(300), ScreenX375(250))];
        _bgView.image = ImageWithName(@"组15");
        [self addSubview:_bgView];
        
        _titleLabel =[[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScreenX375(80))/2, ScreenX375(447), ScreenX375(80), ScreenX375(36))];
        _titleLabel.text = @"梦想";
        _titleLabel.font = Kfont(36);
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.textColor = REXADECIMALCOLOR(@"#000000");
        _titleLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_titleLabel];
        
        _contentLabel =[[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScreenX375(140))/2, ScreenX375(504), ScreenX375(140), ScreenX375(14))];
        _contentLabel.text = @"让服装设计更自由";
        _contentLabel.font = Kfont(14);
        _contentLabel.textColor = REXADECIMALCOLOR(@"#000000");
        _contentLabel.textAlignment = NSTextAlignmentLeft;
        _contentLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_contentLabel];
        
        _sureBtn =[[UIButton alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScreenX375(105))/2, ScreenX375(564), ScreenX375(105), ScreenX375(35))];
        [_sureBtn setTitle:@"立即体验" forState:UIControlStateNormal];
        [_sureBtn setBackgroundImage:ImageWithName(@"按钮背景") forState:UIControlStateNormal];
        [_sureBtn addTarget:self action:@selector(doneClicked) forControlEvents:UIControlEventTouchUpInside];
        _sureBtn.layer.cornerRadius = ScreenX375(17.5);
        _sureBtn.clipsToBounds = YES;
        _sureBtn.hidden = YES;
        [self addSubview:_sureBtn];
        
        return self;
    }
}

-(void)setImage:(UIImage *)image{
    _bgView.image = image;
}

-(void)setTitle:(NSString *)titleLabel{
    _titleLabel.text = titleLabel;
}

-(void)setContent:(NSString *)content{
    _contentLabel.text = content;
}

-(void)setBtn{
    _sureBtn.hidden = NO;
}

-(void)doneClicked{
    if (_sureClick) {
        _sureClick();
    }
}

@end
